package com.apotik.legenda.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Type;


@Entity
@Table(name="apt_sales_transaction")
public class SalesTransaction implements Serializable {
private static final long serialVersionUID = 3448025803207298346L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="transaction_id")
	private Long transactionId;
	
	@Column(name="transaction_code", unique = true, nullable = false, length = 30)
	private String transactionCode;
	
	@Column(name="transaction_date", nullable = false)
	@Temporal(TemporalType.TIMESTAMP)
	private Date transactionDate;
	
	@Column(name="print_struck", nullable=false)
	private boolean printStruck = true; //Y or N
	
	@Column(name="transaction_update")
	@Temporal(TemporalType.TIMESTAMP)
	private Date transactionUpdate;
	
	@ManyToOne
	@JoinColumn(name="shift_id", referencedColumnName = "shift_id", nullable = false)
	private Shift shiftId;
	
	@ManyToOne
	@JoinColumn(name="create_by", referencedColumnName = "user_id", nullable = false)
	private User createBy;
	
	@Column(name="payment_type", length=20, nullable = false)
	private String paymentType;
	
	@Column(name="discount_total", nullable = false)
	private BigDecimal dicountTotal = BigDecimal.ZERO;
	
	@Column(name="payment_total", nullable = false)
	private BigDecimal paymentTotal = BigDecimal.ZERO;
	
	@Column(name="pay", nullable = false)
	private BigDecimal pay = BigDecimal.ZERO;
	
	@Column(name="txr_returns", nullable = false)
	private BigDecimal txrReturns = BigDecimal.ZERO;
	
	@Column(name="services_total", nullable = false)
	private BigDecimal servicesTotal = BigDecimal.ZERO;
	
	@Column(name="refund_total", nullable = false)
	private BigDecimal refundTotal = BigDecimal.ZERO;
	
	@Column(name="notes")
	@Type(type="text")
	private String notes;
	
	@ManyToOne
	@JoinColumn(name="doctor_id", referencedColumnName = "doctor_id")
	private Doctor doctorId;
	
	@ManyToOne
	@JoinColumn(name="customer_id", referencedColumnName = "customer_id")
	private Customer customerId;
	
	

	public Long getTransactionId() {
		return transactionId;
	}

	public void setTransactionId(Long transactionId) {
		this.transactionId = transactionId;
	}

	public String getTransactionCode() {
		return transactionCode;
	}

	public void setTransactionCode(String transactionCode) {
		this.transactionCode = transactionCode;
	}

	public Date getTransactionDate() {
		return transactionDate;
	}

	public void setTransactionDate(Date transactionDate) {
		this.transactionDate = transactionDate;
	}

	public boolean isPrintStruck() {
		return printStruck;
	}

	public void setPrintStruck(boolean printStruck) {
		this.printStruck = printStruck;
	}

	public Date getTransactionUpdate() {
		return transactionUpdate;
	}

	public void setTransactionUpdate(Date transactionUpdate) {
		this.transactionUpdate = transactionUpdate;
	}

	public Shift getShiftId() {
		return shiftId;
	}

	public void setShiftId(Shift shiftId) {
		this.shiftId = shiftId;
	}

	public User getCreateBy() {
		return createBy;
	}
	
	public void setCreateBy(User createBy) {
		this.createBy = createBy;
	}

	public String getPaymentType() {
		return paymentType;
	}

	public void setPaymentType(String paymentType) {
		this.paymentType = paymentType;
	}

	public BigDecimal getDicountTotal() {
		return dicountTotal;
	}

	public void setDicountTotal(BigDecimal dicountTotal) {
		this.dicountTotal = dicountTotal;
	}

	public BigDecimal getPaymentTotal() {
		return paymentTotal;
	}

	public void setPaymentTotal(BigDecimal paymentTotal) {
		this.paymentTotal = paymentTotal;
	}

	public BigDecimal getPay() {
		return pay;
	}

	public void setPay(BigDecimal pay) {
		this.pay = pay;
	}

	public BigDecimal getTxrReturns() {
		return txrReturns;
	}

	public void setTxrReturns(BigDecimal txrReturns) {
		this.txrReturns = txrReturns;
	}

	public BigDecimal getServicesTotal() {
		return servicesTotal;
	}

	public void setServicesTotal(BigDecimal servicesTotal) {
		this.servicesTotal = servicesTotal;
	}

	public BigDecimal getRefundTotal() {
		return refundTotal;
	}

	public void setRefundTotal(BigDecimal refundTotal) {
		this.refundTotal = refundTotal;
	}

	public String getNotes() {
		return notes;
	}

	public void setNotes(String notes) {
		this.notes = notes;
	}

	public Doctor getDoctorId() {
		return doctorId;
	}

	public void setDoctorId(Doctor doctorId) {
		this.doctorId = doctorId;
	}

	public Customer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Customer customerId) {
		this.customerId = customerId;
	}

}
